

#ifndef CARTOGRAPHER_MAPPING_2D_RANGE_DATA_INSERTER_2D_PROBABILITY_GRID_H_
#define CARTOGRAPHER_MAPPING_2D_RANGE_DATA_INSERTER_2D_PROBABILITY_GRID_H_

#include <utility>
#include <vector>

#include "mapping/2d/probability_grid.h"
#include "mapping/2d/xy_index.h"
#include "mapping/sensor/range_data.h"
#include "mapping/2d/node_options.h"

namespace cartographer {
namespace mapping {

class ProbabilityGridRangeDataInserter2D {
public:
    explicit ProbabilityGridRangeDataInserter2D(const ProbabilityGridRangeDataInserterOptions2D &options);

    ProbabilityGridRangeDataInserter2D(const ProbabilityGridRangeDataInserter2D &) = delete;

    ProbabilityGridRangeDataInserter2D &operator=(const ProbabilityGridRangeDataInserter2D &) = delete;

    // Inserts 'range_data' into 'probability_grid'.
    void Insert(const sensor::RangeData &range_data, ProbabilityGrid *probability_grid) const;

private:
    const ProbabilityGridRangeDataInserterOptions2D options_;
    const std::vector<uint16_t>                     hit_table_;
    const std::vector<uint16_t>                     miss_table_;
};

}  // namespace mapping
}  // namespace cartographer

#endif  // CARTOGRAPHER_MAPPING_2D_RANGE_DATA_INSERTER_2D_PROBABILITY_GRID_H_
